from redis import ConnectionPool
import redis


def redis_pool_cache(db=0):
    from modules.utils.configs import get_configs
    redisServer = get_configs().get("redisServer")
    pool = ConnectionPool(host=redisServer.get("host"), port=redisServer.get("port"), db=db,
                          password=redisServer.get("password"))
    r = redis.Redis(connection_pool=pool)
    return r


CACHE = redis_pool_cache()
